Repository navigation
Deploys backfill: resume from a saved page, pause on rate limits, finish with named failures - #497
Merged
Merged
Conversation
…ish with named failures Analytics could show "Counting earlier deploys" for hours and never finish. - Each repository saves where its read stands (range and page) after every page; a pass that runs out of time continues from that page instead of from the first week. A range with more runs than GitHub lists is halved. - A run is checked against everything known without a request first (who started it, the deploy workflows setting, its name and file, its workflow's jobs read once per file); only a possible deploy costs the tag lookup (once per ref) and its jobs read. - GitHub's rate limit (429, or 403 with no requests left or a rate limit message) is a typed error carrying the wait GitHub asked for; the backfill saves progress and queues itself after that wait instead of failing. A webhook's run waits it out the same way, a few times. - A repository that fails three passes in a row without reading a page is named as not read, with why, and the team is marked done. Failing ones are retried by the backfill itself after two minutes, not on the next page load an hour later. - One pass reads per team (a lease on the progress item), so page loads never start parallel chains. - The progress item records repositories read of all; analytics returns it as deploys_backfill_progress, and the repositories given up on as deploys_not_read.
…setup checks say a rate limit is a rate limit On one install the backfill used up the installation's hourly GitHub budget in 14 minutes, and for an hour after that every live job failed: reviews, mark ready, run tools, the code graph index. Pausing on a 403 is too late. - Every response made with an installation token records its core budget (x-ratelimit-remaining, -limit, -reset), successes included, per installation, in this process. - The backfill spends only while at least half that budget is left. Below half, at the start of a pass or before any page, it saves its cursor and waits for the reset, as for a rate limit. - A pass makes at most 1,000 requests, then continues five minutes later. - Tests setup: a rate limit on any read now says GitHub's hourly limit for Coderhelm is used up, when it resets, and to try again then. Only a 404 on the repository says the app can't see it; other refusals say what GitHub answered. A rate limit while reading files is an error, never "no workflow".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Earlier deploys stopped at "Counting..." on large repos: a pass that ran out of time restarted the repo from scratch, rate limits counted as failures, one failing repo blocked the team, and repeated page loads started parallel reads.
Changes
Verification
cargo fmt, clippy -D warnings and cargo test for common, gateway and worker pass; new tests for resume, no-request filtering, rate-limit pause and bounded failures.